﻿using System;
using System.Collections.Generic;

namespace Core.Logger
{
    /// <summary>
    /// After Append event arguments.
    /// </summary>
    public class AfterAppendEventArgs : EventArgs
    {
        public LogItem LogItem { get; private set; }

        public AfterAppendEventArgs(LogItem logItem)
        {
            this.LogItem = logItem;
        }
    }


    /// <summary>
    /// Logging interface.
    /// </summary>
    public interface ILogger
    {
        /// <summary>
        /// Appends log info to the Logger.
        /// The log item status is Info.
        /// </summary>
        /// <param name="message">Message to be logged.</param>
        /// <param name="args">Format arguments.</param>
        void Append(string message, params object[] args);
        
        /// <summary>
        /// Appends log info to the Logger;
        /// </summary>
        /// <param name="status">Log status.</param>
        /// <param name="message">Message to be logged.</param>
        /// <param name="args">Format arguments.</param>
        void Append(LogStatus status, string message, params object[] args);
        
        /// <summary>
        /// Appends a log item.
        /// </summary>
        /// <param name="logItem">Log item</param>
        void Append(LogItem logItem);
        
        /// <summary>
        /// Get All Logs.
        /// </summary>
        /// <returns>Returns a collection of LogItem.</returns>
        List<LogItem> GetLogs();
        
        /// <summary>
        /// Get Log Errors.
        /// </summary>
        /// <returns>Returns a collection of log errors.</returns>
        List<string> GetErrors();
        
        /// <summary>
        /// Get Log Warnings.
        /// </summary>
        /// <returns>Returns a collection of log warnings.</returns>
        List<string> GetWarnings();
        
        /// <summary>
        /// Clear all logs.
        /// </summary>
        void Clear();

        /// <summary>
        /// The event is raised after a log is appended.
        /// </summary>
        event EventHandler<AfterAppendEventArgs> AfterAppend;
        
        /// <summary>
        /// Event raised after the log is cleared.
        /// </summary>
        event EventHandler AfterClear;
    }
}
